package com.example.mobile2032021606168xmy0412homework;

import android.os.Bundle;
import android.os.strictmode.CredentialProtectedWhileLockedViolation;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;

import androidx.appcompat.app.AppCompatActivity;

import org.w3c.dom.Text;

public class MainActivity extends AppCompatActivity {

    private TextView tvMainTitle;
    private TextView tvMainMax;
    private TextView tvMainRequire;
    private TextView tvMainNum1;
    private TextView tvMainNum3;
    private TextView tvMainNum2;
    private EditText editTextTextPassword;
    private EditText editTextTextPassword2;
    private EditText editTextTextPassword3;
    private Button btnMainResult;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        initView();
        btnMainResult.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {

                 String Text1=tvMainNum1.getText().toString();
                  String Text2=tvMainNum2.getText().toString();
                 String Text3=tvMainNum3.getText().toString();
                 int num1=Integer.valueOf(Text1).intValue();
                 int num2=Integer.valueOf(Text2).intValue();
                 int num3=Integer.valueOf(Text3).intValue();
                 btnMainResult.setOnClickListener(this);

                  int a=10;int b=30;int c=20;
                 int max;
                if (a>b){
                 if (a>c){
                   max=a;
                 }else {
                       max=c;
                   }
                 }else {
                   if (b>c){
                     max=b;
                 }else {
                      max=c;
                    }
                  }
                 btnMainResult.getText().toString();

                Text1=String.valueOf(num1);
                tvMainNum1.setText(Text1);

            }
        });
    }

    private void initView() {
        tvMainTitle = (TextView) findViewById(R.id.tv_main_title);
        tvMainMax = (TextView) findViewById(R.id.tv_main_max);
        tvMainRequire = (TextView) findViewById(R.id.tv_main_require);
        tvMainNum1 = (TextView) findViewById(R.id.tv_main_num1);
        tvMainNum3 = (TextView) findViewById(R.id.tv_main_num3);
        tvMainNum2 = (TextView) findViewById(R.id.tv_main_num2);
        editTextTextPassword = (EditText) findViewById(R.id.editTextTextPassword);
        editTextTextPassword2 = (EditText) findViewById(R.id.editTextTextPassword2);
        editTextTextPassword3 = (EditText) findViewById(R.id.editTextTextPassword3);
        btnMainResult = (Button) findViewById(R.id.btn_main_result);
    }
}